﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
#if NET40
namespace System.Diagnostics
{
    //
    // 摘要:
    //     This is the basic API to 'hook' parts of the framework. It is like an EventSource
    //     (which can also write object), but is intended to log complex objects that can't
    //     be serialized. Please See the DiagnosticSource Users Guide https://github.com/dotnet/corefx/blob/master/src/System.Diagnostics.DiagnosticSource/src/DiagnosticSourceUsersGuide.md
    //     for instructions on its use.
    public abstract class DiagnosticSource
    {
        //
        // 摘要:
        //     Write is a generic way of logging complex payloads. Each notification is given
        //     a name, which identifies it as well as a object (typically an anonymous type)
        //     that gives the information to pass to the notification, which is arbitrary. The
        //     name should be short (so don't use fully qualified names unless you have to to
        //     avoid ambiguity), but you want the name to be globally unique. Typically your
        //     componentName.eventName where componentName and eventName are strings less than
        //     10 characters are a good compromise. notification names should NOT have '.' in
        //     them because component names have dots and for them both to have dots would lead
        //     to ambiguity. The suggestion is to use _ instead. It is assumed that listeners
        //     will use string prefixing to filter groups, thus having hierarchy in component
        //     names is good.
        //
        // 参数:
        //   name:
        //     The name of the event being written.
        //
        //   value:
        //     An object that represent the value being passed as a payload for the event. This
        //     is often a anonymous type which contains several sub-values.
        public abstract void Write(string name, object value);

        //
        // 摘要:
        //     Optional: if there is expensive setup for the notification, you can call IsEnabled
        //     before doing this setup. Consumers should not be assuming that they only get
        //     notifications for which IsEnabled is true however, it is optional for producers
        //     to call this API. The name should be the same as what is passed to Write.
        //
        // 参数:
        //   name:
        //     The name of the event being written.
        public abstract bool IsEnabled(string name);
    }
}
#endif